package com.douqu.game.core.config.hegemony;

import com.douqu.game.core.entity.GameObject;
import com.douqu.game.core.factory.DataFactory;
import io.netty.handler.codec.http.HttpServerExpectContinueHandler;

import java.util.List;

/**
 * @author: miracle
 * Description:等级差倍率配置
 * Date: 2018/6/25 0025 下午 5:53
 * Huan Yu Copyright (c) 2017 All Rights Reserved.
 */
public class HegemonyLvDifConfig extends GameObject{

    public int count;

    public int multiple;

    @Override
    public boolean check() {
        return super.check();
    }

    public static int getMultiple(int dif){
        List<HegemonyLvDifConfig> configs = DataFactory.getInstance().getDataList(DataFactory.HEGEMONY_LV_DIF);
        boolean flag = true;
        if (dif < 0){
            flag = false;
        }
        int mul = 100;
        for (HegemonyLvDifConfig config:configs){
            if (flag){
                if (config.count < 0){
                    continue;
                }
                //如果都是正数
                if (dif >= config.count && mul > config.multiple){
                    mul = config.multiple;
                }
            }
            if (!flag){
                if (config.count >= 0){
                    continue;
                }
                //如果都是负数
                if (dif <= config.count && mul < config.multiple){
                    mul = config.multiple;
                }
            }
        }
        return mul;
    }
}
